package com.study.rabbitmq.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;

import java.util.Objects;

/**
 * 消息处理类
 */
@Slf4j
@MqttService
public class MqttTopicHandle {

    @MqttTopic("subTopic")
    public void subTopic(Message<?> message){
        String topic = Objects.requireNonNull(message.getHeaders().get("mqtt_receivedTopic")).toString();
        log.info("订阅主题为:{}，消息为：{}", topic, message.getPayload());
    }
}
